
package Telas;

import Conexao.ConectaBD;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Image;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.awt.Desktop;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;

/**
 *
 * @author Thalyson
 */
public class Tela_Orcamento extends javax.swing.JFrame {

    Connection conecta;
    PreparedStatement pst;
    ResultSet rs;
    
    public Tela_Orcamento() throws ClassNotFoundException {
        initComponents();
        setSize(1283, 653);
        setLocationRelativeTo(null);
        conecta = ConectaBD.conectabd();
        listarOrcamento();
        selecionaProduto();
        Icon();
    }


//<----------------------------------------------------------------------------------------------------------------------------------------->    

    private void Icon(){
    
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("assistec_icon.png")));
        
    }    
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

    public void listarOrcamento() {
        String sql = "Select *from orcamento order by id Desc";
        try {
            pst = conecta.prepareStatement(sql);
            rs = pst.executeQuery();
            jt_orcamento.setModel(DbUtils.resultSetToTableModel(rs));
        } catch (SQLException error) {
            JOptionPane.showMessageDialog(null, error);
        }
    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

    public void cadastrarOrcamento() {
        String sql = "Insert into orcamento (Nome,Endereço,Numero,Telefone,Inicio,Vencimento,Status,Total,Produtos_Serviços) values(?,?,?,?,?,?,?,?,?)";
        
        if(tf_nome.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Nome é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(tf_endereco.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Endereço é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(tf_numero.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Número é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(jf_telefone.getText().equals("(  )    -    ")){
        JOptionPane.showMessageDialog(null, "Campo Telefone é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(jt_produtos.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Adicione ao menos 1 produto à lista", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(cb_status.getSelectedItem().equals("STATUS")){
        JOptionPane.showMessageDialog(null, "Campo Status é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        
        try {
            pst = conecta.prepareStatement(sql);
            pst.setString(1, tf_nome.getText());
            pst.setString(2, tf_endereco.getText());
            pst.setString(3, tf_numero.getText());
            pst.setString(4, jf_telefone.getText());
            pst.setString(5, jf_entrada.getText());
            pst.setString(6, jf_vencimento.getText());
            pst.setString(7, (String) cb_status.getSelectedItem());
            pst.setString(8, tf_total.getText());
            pst.setString(9, jt_produtos.getText());

            pst.execute();
            JOptionPane.showMessageDialog(null, "Registrado com Sucesso!", "Registrado com Sucesso", JOptionPane.INFORMATION_MESSAGE);
            listarOrcamento();
            Limpar();

        } catch (SQLException error) {
            JOptionPane.showMessageDialog(null, error);
        }
    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

    public void pesquisarCliente() {
        String sql = "Select *from orcamento where Nome like ?";

        try {
            pst = conecta.prepareStatement(sql);
            pst.setString(1, tf_pesquisar.getText() + "%");
            rs = pst.executeQuery();
            jt_orcamento.setModel(DbUtils.resultSetToTableModel(rs));
        } catch (SQLException error) {
            JOptionPane.showMessageDialog(null, error);
        }
    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

    public void mostraItens() throws ClassNotFoundException {

        int seleciona = jt_orcamento.getSelectedRow();
        tf_id.setText(jt_orcamento.getModel().getValueAt(seleciona, 0).toString());
        tf_nome.setText(jt_orcamento.getModel().getValueAt(seleciona, 1).toString());
        tf_endereco.setText(jt_orcamento.getModel().getValueAt(seleciona, 2).toString());
        tf_numero.setText(jt_orcamento.getModel().getValueAt(seleciona, 3).toString());
        jf_telefone.setText(jt_orcamento.getModel().getValueAt(seleciona, 4).toString());
        jf_entrada.setText(jt_orcamento.getModel().getValueAt(seleciona, 5).toString());
        jf_vencimento.setText(jt_orcamento.getModel().getValueAt(seleciona, 6).toString());
        cb_status.setSelectedItem(jt_orcamento.getModel().getValueAt(seleciona, 7).toString());
        tf_total.setText(jt_orcamento.getModel().getValueAt(seleciona, 8).toString());
        jt_produtos.setText(jt_orcamento.getModel().getValueAt(seleciona, 9).toString());
    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

    public void editarOrcamento() {
        String sql = "Update orcamento set Nome = ?,Endereço = ?,Numero = ?,Telefone = ?,Inicio = ?,Vencimento = ?,Status = ?,Total = ?,Produtos_Serviços = ? where id = ? ";

        if(tf_nome.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Nome é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(tf_endereco.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Endereço é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(tf_numero.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Número é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(jf_telefone.getText().equals("(  )    -    ")){
        JOptionPane.showMessageDialog(null, "Campo Telefone é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(jf_entrada.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Início é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(jf_vencimento.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Vencimento é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(jt_produtos.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Produtos / Serviços é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        
        try {
            pst = conecta.prepareStatement(sql);
            pst.setString(1, tf_nome.getText());
            pst.setString(2, tf_endereco.getText());
            pst.setString(3, tf_numero.getText());
            pst.setString(4, jf_telefone.getText());
            pst.setString(5, jf_entrada.getText());
            pst.setString(6, jf_vencimento.getText());
            pst.setString(7, (String) cb_status.getSelectedItem());
            pst.setString(8, tf_total.getText());
            pst.setString(9, jt_produtos.getText());
            pst.setInt(10, Integer.parseInt(tf_id.getText()));
            pst.executeUpdate();
            JOptionPane.showMessageDialog(null, "Orçamento atualizado com sucesso");
            listarOrcamento();

        } catch (SQLException error) {
            JOptionPane.showMessageDialog(null, error);
        }
    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

    public void deletarOrcamento() {
        String sql = "Delete from orcamento where id = ?";

        try {
            pst = conecta.prepareStatement(sql);
            pst.setInt(1, Integer.parseInt(tf_id.getText()));
            pst.execute();
            listarOrcamento();
        } catch (SQLException error) {

            JOptionPane.showMessageDialog(null, error);
        }
    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    
    
    public void PDF(String ID, String Nome, String Endereco, String Nº, String Telefone, String Inicio, String Vencimento, String Status, String Valor, String Produtos) throws BadElementException, IOException {

        Document documento = new Document(PageSize.A4, 72, 72, 72, 72);
        try {
            OutputStream outputStream = new FileOutputStream("orçamento.pdf");
            PdfWriter.getInstance(documento, outputStream);
            documento.open();//abre o arquivo

            Image imagem = Image.getInstance("assistec_cabeçalho.png");
            documento.add(imagem);
            documento.add(new Paragraph(new Date().toString()));
            documento.add(new Paragraph("----------------------------------------------ORÇAMENTO----------------------------------------------"));
            documento.add(Chunk.NEWLINE);
            Paragraph AssinaturaTecnicoParagraph = new Paragraph("ID do Orçamento:  " + ID + "     Assinatura do Técnico:______________________________");
            documento.add(AssinaturaTecnicoParagraph);
                     


            //adicionando um texto para o pdf
            Paragraph NomeParagraph = new Paragraph("Cliente:  " + Nome + "  Telefone:  " + Telefone);
            documento.add(NomeParagraph);
            //documento.add(Chunk.NEWLINE);
            Paragraph EnderecoParagraph = new Paragraph("Endereço:  " + Endereco + "  Nº:  " + Nº);
            documento.add(EnderecoParagraph);
            documento.add(Chunk.NEWLINE);
            Paragraph AbertoParagraph = new Paragraph("Data de Entrada:  " + Inicio + "  Data de Vencimento:  " + Vencimento);
            documento.add(AbertoParagraph);
            //documento.add(Chunk.NEWLINE);
            Paragraph StatusParagraph = new Paragraph("Status:  " + Status + "  Valor:  R$" + Valor);
            documento.add(StatusParagraph);
            documento.add(Chunk.NEWLINE);
            Paragraph OSParagraph = new Paragraph("Produtos / Serviços:  " + Produtos);
            documento.add(OSParagraph);
            documento.add(Chunk.NEWLINE);
            documento.add(new Paragraph("----------------------------------------------------------------------------------------------------------------"));
            Paragraph assinaturas = new Paragraph("COMPROVANTE DO TÉCNICO");
            assinaturas.setAlignment(Element.ALIGN_CENTER);
            documento.add(assinaturas);
            Paragraph IDParagraph = new Paragraph("ID do Orçamento:  " + ID + "     Data de Vencimento:  " + Vencimento);
            documento.add(IDParagraph);
            documento.add(Chunk.NEWLINE);
            Paragraph AssinaturaClienteParagraph = new Paragraph("Cliente:___________________________________________________");
            documento.add(AssinaturaClienteParagraph);            
            documento.add(Chunk.NEWLINE);
            Paragraph AssinaturaTecnico2Paragraph = new Paragraph("Técnico:__________________________________________________");
            documento.add(AssinaturaTecnico2Paragraph);


            documento.close();
        } catch (DocumentException ex) {
            JOptionPane.showMessageDialog(null, ex);
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(null, ex);
        }

    }    
//<----------------------------------------------------------------------------------------------------------------------------------------->    
    private void selecionaProduto() {

        try {
                
            String sql = "select * from produto";
            pst = conecta.prepareStatement(sql);
            rs = pst.executeQuery();                
            while (rs.next()) {
                String NomeProduto = rs.getString("Produto_Serviço");
                cb_produto.addItem(NomeProduto);               
            }

        } catch (Exception e) {
        }

    }
    
//<----------------------------------------------------------------------------------------------------------------------------------------->    

        public void Novo(){
        
            try {
                
                tf_nome.setEditable(true);                
                tf_endereco.setEditable(true);
                tf_numero.setEditable(true);
                jf_telefone.setEditable(true);
                jf_entrada.setEditable(true);
                jf_vencimento.setEditable(true);
                jt_produtos.setEditable(true);
                tf_valorunit.setEditable(true);               
                tf_quantidade.setEditable(true);
                tf_totalproduto.setEditable(true);
                tf_cor.setEditable(true);
                tf_total.setEditable(true);
                cb_produto.setEnabled(true);
                cb_status.setEnabled(true);
                jb_adicionar.setEnabled(true);
                jb_remover.setEnabled(true);
                jb_salvar.setEnabled(true);
                jt_produtos.setText("");
                
                Limpar(); 
                
            } catch (Exception e) {
            }
        }
        
//<----------------------------------------------------------------------------------------------------------------------------------------->    

                public void Limpar(){
                                
                tf_nome.setText("");
                tf_endereco.setText("");
                tf_numero.setText("");
                jf_telefone.setText("");
                jf_entrada.setText("");
                jf_vencimento.setText("");
                tf_valorunit.setText("");
                tf_quantidade.setText("");
                tf_totalproduto.setText("");
                tf_cor.setText("");
                tf_total.setText("");
                cb_produto.setSelectedItem("SELECIONE O PRODUTO / SERVIÇO");
                tf_id.setText("");
                
                }    
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jb_salvar = new javax.swing.JButton();
        jb_editar = new javax.swing.JButton();
        jb_excluir = new javax.swing.JButton();
        jb_limpar = new javax.swing.JButton();
        jb_fechar = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_orcamento = new javax.swing.JTable();
        tf_pesquisar = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        tf_id = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        cb_produto = new javax.swing.JComboBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        jt_produtos = new javax.swing.JTextArea();
        tf_valorunit = new javax.swing.JTextField();
        tf_quantidade = new javax.swing.JTextField();
        tf_totalproduto = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        tf_cor = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jb_adicionar = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jb_remover = new javax.swing.JButton();
        jf_telefone = new javax.swing.JFormattedTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        tf_numero = new javax.swing.JTextField();
        tf_endereco = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        tf_nome = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jf_vencimento = new javax.swing.JFormattedTextField();
        jLabel19 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jf_entrada = new javax.swing.JFormattedTextField();
        cb_status = new javax.swing.JComboBox();
        jLabel20 = new javax.swing.JLabel();
        tf_total = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jb_calculadora = new javax.swing.JButton();
        jb_pdf = new javax.swing.JButton();
        jb_novo = new javax.swing.JButton();
        jb_atualizar = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("AssisTec - Orçamento");
        setResizable(false);
        getContentPane().setLayout(null);

        jb_salvar.setBackground(new java.awt.Color(255, 255, 255));
        jb_salvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_salvar.png"))); // NOI18N
        jb_salvar.setText("SALVAR");
        jb_salvar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(78, 78, 78)));
        jb_salvar.setBorderPainted(false);
        jb_salvar.setEnabled(false);
        jb_salvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_salvarActionPerformed(evt);
            }
        });
        getContentPane().add(jb_salvar);
        jb_salvar.setBounds(770, 570, 100, 50);

        jb_editar.setBackground(new java.awt.Color(255, 255, 255));
        jb_editar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_editar.png"))); // NOI18N
        jb_editar.setText("EDITAR");
        jb_editar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(78, 78, 78)));
        jb_editar.setBorderPainted(false);
        jb_editar.setEnabled(false);
        jb_editar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_editarActionPerformed(evt);
            }
        });
        getContentPane().add(jb_editar);
        jb_editar.setBounds(870, 570, 100, 50);

        jb_excluir.setBackground(new java.awt.Color(255, 255, 255));
        jb_excluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_deletar.png"))); // NOI18N
        jb_excluir.setText("EXCLUIR");
        jb_excluir.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(78, 78, 78)));
        jb_excluir.setBorderPainted(false);
        jb_excluir.setEnabled(false);
        jb_excluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_excluirActionPerformed(evt);
            }
        });
        getContentPane().add(jb_excluir);
        jb_excluir.setBounds(970, 570, 100, 50);

        jb_limpar.setBackground(new java.awt.Color(255, 255, 255));
        jb_limpar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_limpar.png"))); // NOI18N
        jb_limpar.setText("LIMPAR");
        jb_limpar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(78, 78, 78)));
        jb_limpar.setBorderPainted(false);
        jb_limpar.setEnabled(false);
        jb_limpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_limparActionPerformed(evt);
            }
        });
        getContentPane().add(jb_limpar);
        jb_limpar.setBounds(1070, 570, 100, 50);

        jb_fechar.setBackground(new java.awt.Color(255, 255, 255));
        jb_fechar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_fechar.png"))); // NOI18N
        jb_fechar.setText("FECHAR");
        jb_fechar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(78, 78, 78)));
        jb_fechar.setBorderPainted(false);
        jb_fechar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_fecharActionPerformed(evt);
            }
        });
        getContentPane().add(jb_fechar);
        jb_fechar.setBounds(1170, 570, 100, 50);

        jSeparator2.setForeground(new java.awt.Color(255, 255, 255));
        getContentPane().add(jSeparator2);
        jSeparator2.setBounds(70, 560, 1210, 10);

        jt_orcamento.setAutoCreateRowSorter(true);
        jt_orcamento.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jt_orcamento.setSelectionBackground(new java.awt.Color(0, 0, 0));
        jt_orcamento.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_orcamentoMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jt_orcamento);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(0, 320, 1280, 220);

        tf_pesquisar.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_pesquisar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_pesquisar.setSelectionColor(new java.awt.Color(0, 0, 0));
        tf_pesquisar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tf_pesquisarKeyReleased(evt);
            }
        });
        getContentPane().add(tf_pesquisar);
        tf_pesquisar.setBounds(1000, 280, 270, 30);

        jLabel15.setBackground(new java.awt.Color(255, 255, 255));
        jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(255, 255, 255));
        jLabel15.setText("PESQUISAR CLIENTE");
        getContentPane().add(jLabel15);
        jLabel15.setBounds(1000, 260, 130, 14);

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_lupa.png"))); // NOI18N
        getContentPane().add(jLabel16);
        jLabel16.setBounds(980, 280, 20, 30);

        tf_id.setEditable(false);
        tf_id.setBackground(new java.awt.Color(255, 255, 255));
        tf_id.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_id.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_id.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_id);
        tf_id.setBounds(1060, 130, 50, 30);

        jLabel14.setBackground(new java.awt.Color(255, 255, 255));
        jLabel14.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel14.setForeground(new java.awt.Color(255, 255, 255));
        jLabel14.setText("ID");
        getContentPane().add(jLabel14);
        jLabel14.setBounds(1060, 110, 30, 20);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_orçamento.png"))); // NOI18N
        getContentPane().add(jLabel2);
        jLabel2.setBounds(1120, 10, 150, 150);

        jLabel10.setBackground(new java.awt.Color(255, 255, 255));
        jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(255, 255, 255));
        jLabel10.setText("ORÇAMENTO");
        getContentPane().add(jLabel10);
        jLabel10.setBounds(1160, 170, 90, 14);

        jLabel13.setBackground(new java.awt.Color(255, 255, 255));
        jLabel13.setForeground(new java.awt.Color(255, 255, 255));
        jLabel13.setText("AssisTec");
        getContentPane().add(jLabel13);
        jLabel13.setBounds(10, 550, 60, 14);

        cb_produto.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        cb_produto.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SELECIONE O PRODUTO / SERVIÇO" }));
        cb_produto.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        cb_produto.setEnabled(false);
        cb_produto.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                cb_produtoPopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });
        cb_produto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_produtoActionPerformed(evt);
            }
        });
        getContentPane().add(cb_produto);
        cb_produto.setBounds(10, 100, 580, 30);

        jt_produtos.setEditable(false);
        jt_produtos.setColumns(20);
        jt_produtos.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jt_produtos.setRows(5);
        jt_produtos.setSelectionColor(new java.awt.Color(0, 0, 0));
        jScrollPane3.setViewportView(jt_produtos);

        getContentPane().add(jScrollPane3);
        jScrollPane3.setBounds(10, 140, 580, 170);

        tf_valorunit.setEditable(false);
        tf_valorunit.setBackground(new java.awt.Color(255, 255, 255));
        tf_valorunit.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_valorunit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_valorunit.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_valorunit);
        tf_valorunit.setBounds(600, 160, 70, 30);

        tf_quantidade.setEditable(false);
        tf_quantidade.setBackground(new java.awt.Color(255, 255, 255));
        tf_quantidade.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_quantidade.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_quantidade.setSelectionColor(new java.awt.Color(0, 0, 0));
        tf_quantidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tf_quantidadeActionPerformed(evt);
            }
        });
        getContentPane().add(tf_quantidade);
        tf_quantidade.setBounds(680, 160, 80, 30);

        tf_totalproduto.setEditable(false);
        tf_totalproduto.setBackground(new java.awt.Color(255, 255, 255));
        tf_totalproduto.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_totalproduto.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_totalproduto.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_totalproduto);
        tf_totalproduto.setBounds(770, 160, 90, 30);

        jLabel3.setBackground(new java.awt.Color(255, 255, 255));
        jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("TOTAL PRODUTO");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(770, 140, 110, 14);

        jLabel6.setBackground(new java.awt.Color(255, 255, 255));
        jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setText("QUANTIDADE");
        getContentPane().add(jLabel6);
        jLabel6.setBounds(680, 140, 80, 14);

        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("VALOR UNIT.");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(600, 140, 80, 14);

        jLabel18.setBackground(new java.awt.Color(255, 255, 255));
        jLabel18.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel18.setForeground(new java.awt.Color(255, 255, 255));
        jLabel18.setText("SELECIONE O PRODUTO / SERVIÇO");
        getContentPane().add(jLabel18);
        jLabel18.setBounds(10, 80, 220, 14);

        tf_cor.setEditable(false);
        tf_cor.setBackground(new java.awt.Color(255, 255, 255));
        tf_cor.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_cor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_cor.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_cor);
        tf_cor.setBounds(600, 220, 170, 30);

        jLabel22.setBackground(new java.awt.Color(255, 255, 255));
        jLabel22.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel22.setForeground(new java.awt.Color(255, 255, 255));
        jLabel22.setText("COR");
        getContentPane().add(jLabel22);
        jLabel22.setBounds(600, 200, 27, 14);

        jb_adicionar.setBackground(new java.awt.Color(255, 255, 255));
        jb_adicionar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_adicionar.png"))); // NOI18N
        jb_adicionar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        jb_adicionar.setBorderPainted(false);
        jb_adicionar.setEnabled(false);
        jb_adicionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_adicionarActionPerformed(evt);
            }
        });
        getContentPane().add(jb_adicionar);
        jb_adicionar.setBounds(600, 100, 60, 30);

        jLabel25.setBackground(new java.awt.Color(255, 255, 255));
        jLabel25.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel25.setForeground(new java.awt.Color(255, 255, 255));
        jLabel25.setText("ADICIONAR");
        getContentPane().add(jLabel25);
        jLabel25.setBounds(600, 80, 70, 14);

        jLabel26.setBackground(new java.awt.Color(255, 255, 255));
        jLabel26.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel26.setForeground(new java.awt.Color(255, 255, 255));
        jLabel26.setText("LIMPAR");
        getContentPane().add(jLabel26);
        jLabel26.setBounds(770, 80, 50, 14);

        jb_remover.setBackground(new java.awt.Color(255, 255, 255));
        jb_remover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_remover.png"))); // NOI18N
        jb_remover.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        jb_remover.setBorderPainted(false);
        jb_remover.setEnabled(false);
        jb_remover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_removerActionPerformed(evt);
            }
        });
        getContentPane().add(jb_remover);
        jb_remover.setBounds(770, 100, 60, 30);

        jf_telefone.setEditable(false);
        jf_telefone.setBackground(new java.awt.Color(255, 255, 255));
        jf_telefone.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        try {
            jf_telefone.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jf_telefone.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jf_telefone.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(jf_telefone);
        jf_telefone.setBounds(480, 30, 110, 30);

        jLabel5.setBackground(new java.awt.Color(255, 255, 255));
        jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("TELEFONE");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(480, 10, 70, 14);

        jLabel7.setBackground(new java.awt.Color(255, 255, 255));
        jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setText("Nº");
        getContentPane().add(jLabel7);
        jLabel7.setBounds(430, 10, 40, 14);

        tf_numero.setEditable(false);
        tf_numero.setBackground(new java.awt.Color(255, 255, 255));
        tf_numero.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_numero.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_numero.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_numero);
        tf_numero.setBounds(430, 30, 40, 30);

        tf_endereco.setEditable(false);
        tf_endereco.setBackground(new java.awt.Color(255, 255, 255));
        tf_endereco.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_endereco.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_endereco.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_endereco);
        tf_endereco.setBounds(220, 30, 200, 30);

        jLabel8.setBackground(new java.awt.Color(255, 255, 255));
        jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 255, 255));
        jLabel8.setText("ENDEREÇO");
        getContentPane().add(jLabel8);
        jLabel8.setBounds(220, 10, 80, 14);

        tf_nome.setEditable(false);
        tf_nome.setBackground(new java.awt.Color(255, 255, 255));
        tf_nome.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        tf_nome.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_nome.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_nome);
        tf_nome.setBounds(10, 30, 200, 30);

        jLabel9.setBackground(new java.awt.Color(255, 255, 255));
        jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(255, 255, 255));
        jLabel9.setText("NOME DO CLIENTE");
        getContentPane().add(jLabel9);
        jLabel9.setBounds(10, 10, 130, 14);

        jf_vencimento.setEditable(false);
        jf_vencimento.setBackground(new java.awt.Color(255, 255, 255));
        jf_vencimento.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        try {
            jf_vencimento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jf_vencimento.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jf_vencimento.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(jf_vencimento);
        jf_vencimento.setBounds(690, 30, 80, 30);

        jLabel19.setBackground(new java.awt.Color(255, 255, 255));
        jLabel19.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel19.setForeground(new java.awt.Color(255, 255, 255));
        jLabel19.setText("VENCIMENTO");
        getContentPane().add(jLabel19);
        jLabel19.setBounds(690, 10, 90, 14);

        jLabel11.setBackground(new java.awt.Color(255, 255, 255));
        jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(255, 255, 255));
        jLabel11.setText("ENTRADA");
        getContentPane().add(jLabel11);
        jLabel11.setBounds(600, 10, 70, 14);

        jf_entrada.setEditable(false);
        jf_entrada.setBackground(new java.awt.Color(255, 255, 255));
        jf_entrada.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        try {
            jf_entrada.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jf_entrada.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jf_entrada.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(jf_entrada);
        jf_entrada.setBounds(600, 30, 80, 30);

        cb_status.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        cb_status.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "STATUS", "ABERTO", "FECHADO" }));
        cb_status.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        cb_status.setEnabled(false);
        getContentPane().add(cb_status);
        cb_status.setBounds(600, 280, 110, 30);

        jLabel20.setBackground(new java.awt.Color(255, 255, 255));
        jLabel20.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel20.setForeground(new java.awt.Color(255, 255, 255));
        jLabel20.setText("STATUS");
        getContentPane().add(jLabel20);
        jLabel20.setBounds(600, 260, 60, 14);

        tf_total.setEditable(false);
        tf_total.setBackground(new java.awt.Color(255, 255, 255));
        tf_total.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        tf_total.setSelectionColor(new java.awt.Color(0, 0, 0));
        getContentPane().add(tf_total);
        tf_total.setBounds(720, 280, 80, 30);

        jLabel17.setBackground(new java.awt.Color(255, 255, 255));
        jLabel17.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel17.setForeground(new java.awt.Color(255, 255, 255));
        jLabel17.setText("TOTAL R$");
        getContentPane().add(jLabel17);
        jLabel17.setBounds(720, 260, 60, 14);

        jb_calculadora.setBackground(new java.awt.Color(255, 255, 255));
        jb_calculadora.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_calculadora.png"))); // NOI18N
        jb_calculadora.setText("CALCULADORA");
        jb_calculadora.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        jb_calculadora.setBorderPainted(false);
        jb_calculadora.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_calculadoraActionPerformed(evt);
            }
        });
        getContentPane().add(jb_calculadora);
        jb_calculadora.setBounds(990, 10, 120, 50);

        jb_pdf.setBackground(new java.awt.Color(255, 255, 255));
        jb_pdf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_pdf.gif"))); // NOI18N
        jb_pdf.setText("GERAR PDF");
        jb_pdf.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(78, 78, 78)));
        jb_pdf.setBorderPainted(false);
        jb_pdf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_pdfActionPerformed(evt);
            }
        });
        getContentPane().add(jb_pdf);
        jb_pdf.setBounds(890, 10, 100, 50);

        jb_novo.setBackground(new java.awt.Color(255, 255, 255));
        jb_novo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_novo.png"))); // NOI18N
        jb_novo.setText("NOVO");
        jb_novo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        jb_novo.setBorderPainted(false);
        jb_novo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_novoActionPerformed(evt);
            }
        });
        getContentPane().add(jb_novo);
        jb_novo.setBounds(10, 570, 100, 50);

        jb_atualizar.setBackground(new java.awt.Color(255, 255, 255));
        jb_atualizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_atualizar.png"))); // NOI18N
        jb_atualizar.setText("ATUALIZAR");
        jb_atualizar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
        jb_atualizar.setBorderPainted(false);
        jb_atualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jb_atualizarActionPerformed(evt);
            }
        });
        getContentPane().add(jb_atualizar);
        jb_atualizar.setBounds(110, 570, 100, 50);

        jLabel27.setBackground(new java.awt.Color(255, 255, 255));
        jLabel27.setForeground(new java.awt.Color(255, 255, 255));
        jLabel27.setText("TABELA DE ORÇAMENTO");
        getContentPane().add(jLabel27);
        jLabel27.setBounds(570, 540, 150, 20);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/assistec_fundo2.png"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 1280, 650);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jb_salvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_salvarActionPerformed
        cadastrarOrcamento();
    }//GEN-LAST:event_jb_salvarActionPerformed

    private void jb_editarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_editarActionPerformed
        editarOrcamento();
    }//GEN-LAST:event_jb_editarActionPerformed

    private void jb_excluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_excluirActionPerformed
        deletarOrcamento();
    }//GEN-LAST:event_jb_excluirActionPerformed

    private void jb_limparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_limparActionPerformed
                Limpar();
    }//GEN-LAST:event_jb_limparActionPerformed

    private void jb_fecharActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_fecharActionPerformed
        dispose();
    }//GEN-LAST:event_jb_fecharActionPerformed

    private void jt_orcamentoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_orcamentoMouseClicked
        try {
            mostraItens();
            jb_editar.setEnabled(true);
            jb_limpar.setEnabled(true);
            jb_excluir.setEnabled(true);
            jb_salvar.setEnabled(false);
            
            tf_nome.setEditable(true);                
                tf_endereco.setEditable(true);
                tf_numero.setEditable(true);
                jf_telefone.setEditable(true);
                jf_entrada.setEditable(true);
                jf_vencimento.setEditable(true);
                jt_produtos.setEditable(true);
                tf_valorunit.setEditable(true);               
                tf_quantidade.setEditable(true);
                tf_totalproduto.setEditable(true);
                tf_cor.setEditable(true);
                tf_total.setEditable(true);
                cb_produto.setEnabled(true);
                cb_status.setEnabled(true);
                jb_adicionar.setEnabled(true);
                jb_remover.setEnabled(true);
                jb_salvar.setEnabled(false);
                
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Tela_Orcamento.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jt_orcamentoMouseClicked

    private void tf_pesquisarKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tf_pesquisarKeyReleased
        pesquisarCliente();
    }//GEN-LAST:event_tf_pesquisarKeyReleased

    private void cb_produtoPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_cb_produtoPopupMenuWillBecomeInvisible
        String np = (String)cb_produto.getSelectedItem();
        String sql = "select * from produto where Produto_Serviço = ?";
        try {

            pst = conecta.prepareCall(sql);
            pst.setString(1, np);
            rs = pst.executeQuery();
            if(rs.next()){
            String valor = rs.getString("Preço");
            tf_valorunit.setText(valor);
            String cor = rs.getString("Cor");
            tf_cor.setText(cor);
            }

        } catch (Exception e) {
        }
    }//GEN-LAST:event_cb_produtoPopupMenuWillBecomeInvisible

    private void cb_produtoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_produtoActionPerformed

    }//GEN-LAST:event_cb_produtoActionPerformed

    private void tf_quantidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_quantidadeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tf_quantidadeActionPerformed

    private void jb_adicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_adicionarActionPerformed
        String produto = cb_produto.getSelectedItem()+"  Cor: "+tf_cor.getText()+"  Quantidade: "+tf_quantidade.getText()+"  Unidade.R$:"+tf_valorunit.getText()+"  Total.R$:"+tf_totalproduto.getText();

        if(tf_quantidade.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Quantidade é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if(tf_totalproduto.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Campo Total produto é Obrigatório", "Aviso", JOptionPane.WARNING_MESSAGE);
        return;
        }
        if (cb_produto.getSelectedItem().equals("SELECIONE O PRODUTO / SERVIÇO")) {
            JOptionPane.showMessageDialog(null, "Selecione um produto para adicionar", "Aviso", JOptionPane.WARNING_MESSAGE);
            return;
        }

        jt_produtos.append(produto +"\n");
    }//GEN-LAST:event_jb_adicionarActionPerformed

    private void jb_removerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_removerActionPerformed
        jt_produtos.setText("");
    }//GEN-LAST:event_jb_removerActionPerformed

    private void jb_calculadoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_calculadoraActionPerformed
        Tela_Calc tc = new Tela_Calc();
        tc.setVisible(true);
    }//GEN-LAST:event_jb_calculadoraActionPerformed

    private void jb_pdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_pdfActionPerformed

        if (Desktop.isDesktopSupported()) {
            try {
                PDF(tf_id.getText(), tf_nome.getText(), tf_endereco.getText(), tf_numero.getText(), jf_telefone.getText(), jf_entrada.getText(), jf_vencimento.getText(), (String) cb_status.getSelectedItem(), tf_total.getText(), jt_produtos.getText());
                File myFile = new File("orçamento.pdf");
                Desktop.getDesktop().open(myFile);
            } catch (IOException ex) {
            } catch (BadElementException ex) {
                Logger.getLogger(Tela_Orcamento.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    }//GEN-LAST:event_jb_pdfActionPerformed

    private void jb_novoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_novoActionPerformed
        Novo();
        jb_editar.setEnabled(false);
        jb_excluir.setEnabled(false);
        jb_limpar.setEnabled(true);
    }//GEN-LAST:event_jb_novoActionPerformed

    private void jb_atualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_atualizarActionPerformed
        listarOrcamento();
        jb_editar.setEnabled(false);
        jb_excluir.setEnabled(false);
    }//GEN-LAST:event_jb_atualizarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Tela_Orcamento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Tela_Orcamento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Tela_Orcamento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Tela_Orcamento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new Tela_Orcamento().setVisible(true);
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(Tela_Orcamento.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox cb_produto;
    private javax.swing.JComboBox cb_status;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JButton jb_adicionar;
    private javax.swing.JButton jb_atualizar;
    private javax.swing.JButton jb_calculadora;
    private javax.swing.JButton jb_editar;
    private javax.swing.JButton jb_excluir;
    private javax.swing.JButton jb_fechar;
    private javax.swing.JButton jb_limpar;
    private javax.swing.JButton jb_novo;
    private javax.swing.JButton jb_pdf;
    private javax.swing.JButton jb_remover;
    private javax.swing.JButton jb_salvar;
    private javax.swing.JFormattedTextField jf_entrada;
    private javax.swing.JFormattedTextField jf_telefone;
    private javax.swing.JFormattedTextField jf_vencimento;
    private javax.swing.JTable jt_orcamento;
    private javax.swing.JTextArea jt_produtos;
    private javax.swing.JTextField tf_cor;
    private javax.swing.JTextField tf_endereco;
    private javax.swing.JTextField tf_id;
    private javax.swing.JTextField tf_nome;
    private javax.swing.JTextField tf_numero;
    private javax.swing.JTextField tf_pesquisar;
    private javax.swing.JTextField tf_quantidade;
    private javax.swing.JTextField tf_total;
    private javax.swing.JTextField tf_totalproduto;
    private javax.swing.JTextField tf_valorunit;
    // End of variables declaration//GEN-END:variables
}
